<template>
  <base-breadcrumb :breadcrumb="!isAudit" class="fixed-container">
    <a-form-model
      ref="ruleForm"
      :model="form"
      :rules="rules"
      :label-col="{ lg: { span: 6 }, sm: { span: 6 } }"
      :wrapper-col="{ lg: { span: 16 }, sm: { span: 16 } }"
      :hideRequiredMark="true"
    >
    <a-card>
      <titleName title="基本信息" />
        <a-row :gutter="24">
          <a-col :md="8" :sm="8" >
            <a-form-model-item label="所属分公司" prop="branchCompanyId" >
              <SelectSubCompany
                v-model="form.branchCompanyId"
                placeholder="请选择"
                @selectChange="branchCompanChange"
                :disabled="pageType !== 'add' && pageType !== 'edit'"
              />
            </a-form-model-item>
          </a-col>
          <a-col :md="8" :sm="8" >
            <a-form-model-item
              label="区域"
              prop="zoneId"
            >
              <SelectArea
                v-model="form.zoneId"
                placeholder="请选择"
                :form="form"
                :is-clear="id == ''"
                key-value="branchCompanyId"
                :disabled="pageType !== 'add' && pageType !== 'edit'"
                :getPopupContainer="PopupContaine"
                @getOption="zoneChange"
              />
            </a-form-model-item>
          </a-col>
          <a-col :md="8" :sm="8" >
            <a-form-model-item label="业态" prop="businessStatusId" >
              <SelectFormat
                v-model="form.businessStatusId"
                placeholder="请选择"
                :is-clear="id == ''"
                :disabled="pageType !== 'add' && pageType !== 'edit'"
                :getPopupContainer="PopupContaine"
                @getOption="(res) => form.businessStatusName = res ? res.name : ''"
              />
            </a-form-model-item>
          </a-col>
          <a-col :md="8" :sm="8" >
            <a-form-model-item label="季度" prop="quarterlyId" >
              <Selector
                v-model="form.quarterlyId"
                placeholder="请选择"
                :disabled="pageType !== 'add' && pageType !== 'edit'"
                :getPopupContainer="PopupContaine"
                :customApi="quarterlyData"
                @getOption="quarterlyChange"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
    </a-card>

    <a-card>
      <titleName title="资料项" />
        <a-row :gutter="24" type="flex" justify="space-between">
          <a-col :md="8" :sm="8" >
            <a-form-model-item label="成本价格信息名称" prop="additionalPropId" labelAlign="left" >
              <a-select
                v-model="form.additionalPropId"
                placeholder="请选择"
                allow-clear
                @change="costPriceChange"
              >
                <a-icon v-if="costPricefetching" slot="suffixIcon" style="color: #096dd9" type="loading" />
                <a-spin v-if="costPricefetching" slot="notFoundContent" size="small" />

                <a-select-option v-for="(item, index) in costPriceDataList" :key="item.id" :value="item.id">
                  {{ item.name }}
                  <span v-if="item.noFilled" style="color: #f5222d;">（未填写）</span>
                </a-select-option>
              </a-select>
              <!-- <Selector
                v-model="form.additionalPropId"
                placeholder="请选择"
                :getPopupContainer="PopupContaine"
                :isEmpty="true"
                :customQueryType="{ query: { type: form.branchCompanyId }}"
                :customApi="costPriceList"
                @getOption="costPriceChange"
                :isDefault="pageType !== 'add'"
              /> -->
            </a-form-model-item>
          </a-col>
          <a-col :md="8" :sm="8" style="text-align: right;">
            <a v-if="pageType == 'add'" @click="toCostPriceInfo">成本价格信息名称配置</a>
          </a-col>
          <a-col :md="24" :sm="24">
            <BaseTextarea v-model="form.illustrateInfo" disabled></BaseTextarea>
          </a-col>
        </a-row>

        <ConstPriceTable
          :arrtId="form.additionalPropId"
          :companyType="companyType"
          ref="costPriceTable"
          :datas="tableList"
          @listChange="listChange"
          @fillIn="fillInSave"
        />
    </a-card>
    </a-form-model>

    <div v-if="!isConsultation" class="btn_box tool-btns--fixed page-btn-right-top">
      <span v-if="pageType == 'add' || pageType == 'edit'">
        <a-button type="primary" :loading="loading.DRAFT" class="ml12" @click="handleSave('DRAFT')">保存草稿</a-button>
        <a-button type="primary" :loading="loading.SUBMITTED" class="ml12" @click="handleSave('SUBMITTED')">提交</a-button>
      </span>
      <span v-if="pageType == 'fill'">
        <a-button type="primary" :loading="loading.FILLIN" class="ml12" @click="fillInSave(false)">提交</a-button>
      </span>
      <a-button class="ml12" @click="$close">关闭</a-button>
    </div>
    <selectApprover :businessId="businessId"  :processConfig="setProcessConfig"></selectApprover>
  </base-breadcrumb>
</template>
<script>
import { getProjectInfo } from '@/api/businessAffairs/revenueAndCost'
import { getSubcontractorCostList, subcontractorCostEdit, quarterlyData, costPriceList, subcontractorCostDetail, subcontractorCostFillIn, fillStatus } from '@/api/businessAffairs/subcostprice'
import Ellipsis from '@/components/Ellipsis'
import {
    addSubcontractorCost,editSubcontractorCost,delSubcontractorCost,checkSubcontractorCost,
    //左边分类设置
    getClassificationSettings,addClassificationSettings,editClassificationSettings,delClassificationSettings,checkClassificationSettings,
    //右边表格增删改查
    addManagement,editManagement,delManagement,checkManagement,} from '@/api/businessAffairs/subcontractCostPrice'
import { getSelectListByType } from '@/api/businessAffairs/common.js'
import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
import SelectArea from '@/components/Select/SelectArea' // 区域
import SelectFormat from '@/components/Select/SelectFormat' // 业态
import Selector from '@/components/Select/Selector'
import { isAttachment ,checkVisibleInDetail} from '@/utils/util'
import { STable } from '@/components'
import UploadList from '@/components/UploadList'
import claModel from './claModel'
import managementModel from './managementModel'
import ConstPriceTable from './costPriceTable.vue'
const columns = [
    {
        title: '序号',
        dataIndex: 'sortNum',
        width: '80px'
    },
    {
        title: '分部分项',
        dataIndex: 'partAndProject',
    },
    {
        title: '特征描述',
        dataIndex: 'featureDesc',
        // width:'40%'
    },
    {
        title: '工作内容',
        dataIndex: 'jobContent',
    },
    {
        title: '工程量计算规则',
        dataIndex: 'projectCountRules',
    },
    {
        title: '材料及机械设备供应',
        dataIndex: 'materialAndMechanicalEquipmentSupply',
    },
    {
        title: '计量单位',
        dataIndex: 'unitOfMeasurement',
    },
    {
        title: '公司控制价（不含税）(元)',
        dataIndex: 'companyControlFeeNotIncludeFex',
        // width: '170px',
    },
    {
        title: '备注',
        dataIndex: 'remark',
    },
    {
        title: '签约最低价(不含税)(元)',
        dataIndex: 'remark11',
    },
    {
        title: '项目一',
        dataIndex: 'project',
        children: [
          {
            title: '签约价（不含税）（元）',
          },
          {
            title: '签约日期',
          },
          {
            title: '与公司控制价清单差异',
          }
        ]
    },
]

export default {
    name:'a'+Date.now(),
    components: {
        SelectSubCompany,
        SelectArea,
        SelectFormat,
        Selector,
        STable,
        claModel,
        Ellipsis,
        managementModel,
        ConstPriceTable
    },
    data() {
        this.columns = columns
        return {
            quarterlyData,
            checkVisibleInDetail:checkVisibleInDetail(this),
            loading: {
                DELETE: false,
                DRAFT: false,
                SUBMITTED: false,
                FILLIN: false
            },
            clasModel: {
                update: false,
                childInitData: {},
            },
            manModel: {
                update: false,
                childInitData: {},
            },
            curTemplateIndex: '',
            spinning: false,
            step: 0,
            form: {
              additionalPropId: undefined,
              illustrateInfo: undefined,
              zoneId: undefined,
              listData: {
                // "775628834069417984": [{
                //   id: new Date().getTime(),
                //   partAndProject: '分部分项',
                //   featureDesc: '特征描述',
                //   jobContent: '工作内容',
                //   projectCountRules: '工程量计算规则',
                //   materialAndMechanicalEquipmentSupply: '材料及机械设备供应',
                //   companyControlFeeNotIncludeFex: '公司控制价（不含税）(元)',
                //   unitOfMeasurement: '计量单位',
                // }]
              }
            },

            rules: {
                branchCompanyId: [{ required: true, message: '请选择分公司' }],
                zoneId: [{ required: true, message: '请选择区域' }],
                businessStatusId: [{ required: true, message: '请选择业态' }],
                quarterlyId: [{ required: true, message: '请选择季度' }],
                additionalPropId: [{ required: true, message: '请选择成本价格信息名称' }]
            },
            loadData: async () => {
                return new Promise((resolve, reject) => {
                    resolve({
                        data: this.form.rightList,
                    })
                })
            },
            id: '',
            pageType: '',

            tableList: [],
            costPricefetching: false,
            costPriceDataList: [],
            //获取流程配置值
            processConfig: null,
            //点击提交发送流程配置值
            setProcessConfig: null,
            businessId: null
        }
    },
    props: {
        isAudit: {
            // 是否作为审批详情
            type: Boolean,
            default: false,
        },
        // 是否作为意见征询
        isConsultation: {
          type: Boolean,
          default: false
        }
    },
    computed: {
      companyType() {
        if (this.form.branchCompanyId == 'cdcfa929b51a47269f336364860c9f0c') { // 装饰分公司
          return 'decorate'
        } else if (this.form.branchCompanyId == 'ecf764c08dd94fa889ce31c380b1241c') { // 安装分公司
          return 'install'
        } else {
          return 'normal'
        }
      },
    },
    watch: {
        isAudit: {
            immediate: true,
            handler(val) {
                if (val) {
                    this.$nextTick(() => {
                        this.pageType = 'look'
                    })
                }
            },
        },
    },

    async mounted() {
        if (this.$route.query.id) {
            this.id = this.$route.query.id
            this.step = 1

            this.checkSubcontractorCostReq()
        }
        this.pageType = this.$route.query.pageType
        if(isConsultation){
          this.$route.meta.title = '意见征询'
        }else{
          if (this.pageType == 'look') {
              this.$route.meta.title = '分包人指导价查看'
          } else {
              this.$route.meta.title = this.id == '' ? '分包人指导价新增' : '分包人指导价编辑'
          }
        }
        
      //获取通过获取流程配置值
       this.processConfig = await this.$getConfigFn('comm_subcontract_cost_guid')
    },

    methods: {
        quarterlyChange(val) {
          this.form.quarterly = val ? val.name : ''
          // return
          if (!val || (this.pageType !== 'add')) return
          this.loading.SUBMITTED = true
          this.loading.DRAFT = true
          let param = {
            pageNo: 1,
            pageSize: 10,
            query: {
              branchComId: this.form.branchCompanyId,
              quarterlyId: val.id
            }
          }
          getSubcontractorCostList(param).then((res) => {
            if (res.code == 200 || res.data.code == 200) {
              let list = res.data.filter((item, index) => {
                return item.status !== 'ABOLISH'
              })
              if (list && list.length > 0) {
                this.$message.error('所属分公司当前季度已有数据！')
                this.form.quarterly = ''
                this.form.quarterlyId = undefined
              } else {
                this.form.quarterly = val.name
                this.form.quarterlyId = val.id
              }
            }
            this.loading.SUBMITTED = false
            this.loading.DRAFT = false
          })
        },
        branchCompanChange(val) {
          if (val) {
            this.costPricefetching = true
            costPriceList({id: this.form.branchCompanyId}).then((res) => {
              this.costPricefetching = false
              // this.costPriceDataList = res.data
              let data = res.data
              this.costPriceDataList = data.map((item, index) => {
                if (this.pageType == 'fill') {
                  let obj = this.form.costPriceInfo?.find((e) => e.id == item.id)
                  item.noFilled = obj?.noFilled
                }
                return item
              })
              if (data.length) {
                this.costPriceChange(data[0].id)
              }
            }).catch(() => {
              this.costPricefetching = false
            })
          }
        },
        zoneChange(res) {
          if (this.pageType == 'add') {
            this.form.zoneId = res ? res.id : undefined
          }
          this.form.zoneName = res ? res.name : ''
        },
        costPriceList() {
          if (!this.form.branchCompanyId) {
            return Promise.resolve({data: []})
          } else {
            // if (this.pageType == 'look') {
            //   let data = this.form.costPriceInfo[0] || {}
            //   this.$set(this.form, 'additionalPropId', data.id)
            //   this.costPriceChange(data)
            //   return Promise.resolve({data: this.form.costPriceInfo})
            // }
            return costPriceList({id: this.form.branchCompanyId})
          }
        },
        costPriceChange(val) {
          let res = this.costPriceDataList.find((e) => e.id == val)
          this.$set(this.form, 'additionalPropId', res ? res.id : undefined)
          this.$set(this.form, 'illustrateInfo', res ? res.illustrateInfo : undefined)
          if (!res) return
          this.tableList = this.form.listData[res.id] || []
        },
        listChange(list) {
          // console.log(this.form.additionalPropId)
          let id = this.form.additionalPropId
          this.form.listData[id] = list
          this.tableList = list
          // console.log(this.form.listData)
        },
        PopupContaine() {
          return document.body
        },
        handleUpdateClaConfirm() {
            this.clasModel.update = false
            this.checkSubcontractorCostReq()
        },
        handleUpdateManConfirm() {
            this.manModel.update = false
            this.checkSubcontractorCostReq()
        },
        toCostPriceInfo() {
          let branchCompanyId = this.form.branchCompanyId
          this.$router.push({
            name: 'costPriceInfo',
            query: {
              branchCompanyId
            }
          })
        },
        // 处理分类更新操作（新增、编辑）
        async handleUpdateCla(type, data = {}) {
            if (type == 'del') {
                let params = {
                    id: data.id,
                }
                const [err, res] = await delSelectListByType(params)
                if (!err) {
                    this.$message.success('删除成功')
                    this.$refs.table.refresh(true)
                }
                return
            }
            this.clasModel.childInitData = {
                ...data,
                guidId: this.id,
                pageType: type,
            }
            this.clasModel.update = true
        },
        async delManagement(params) {
            const [err, res] = await delManagement(params)
            if (!err) {
                this.$message.success('删除成功')
                this.checkSubcontractorCostReq()
            }
        },
        // 处理分类更新操作（新增、编辑）
        async handleTable(type, data = {}) {
            if (type == 'del') {
                let params = {
                    id: data.id,
                    cateId: this.form.cateVOS[this.curTemplateIndex].id,
                }
                let that = this
                this.$confirm({
                    title:"温馨提示",
                content: '确定是否删除数据？',
                okText: '确认',
                okType: 'danger',
                cancelText: '取消',
                    onOk: () => {
                        return that.delManagement(params)
                    },
                })
            } else {
                this.manModel.childInitData = {
                    ...data,
                    cateId: this.form.cateVOS[this.curTemplateIndex].id,
                    pageType: type,
                }
                this.manModel.update = true
            }
        },
        async checkSubcontractorCostReq(refresh) {
            this.spinning = true
            const res = await subcontractorCostDetail({ id: this.id })
            this.spinning = false
            if (res.code == 200) {
                this.form = res.data
                let listData = {}
                let costPriceInfo = [ ...res.data.costPriceInfo ]
                costPriceInfo.map((item, index) => {
                  let id = item.id
                  item.noFilled = false
                  let list = item.costPriceInfoDetail
                  listData[id] = list.map((e) => {
                    // e.listId = e.id
                    let isFilled = e.fillInDataList.find((v) => v.projectId == this.$currentPost().id)
                    if (!isFilled) {
                      item.noFilled = true
                    }
                    if (this.pageType == 'edit') {
                      delete e.fillInDataList
                      delete e.id
                    } else if (this.pageType == 'fill') {
                      e.disabled = true
                    }
                    return e
                  }).filter((v) => {
                    if (this.$currentPost().code == 'PD') {
                      return v.projectOrgId ? (v.projectOrgId == this.$currentPost().id) : true
                    } else {
                      return true
                    }
                  })
                })
                this.$set(this.form, 'listData', listData)
                this.$set(this.form, 'costPriceInfo', costPriceInfo)
                this.$set(this.form, 'branchCompanyId', res.data.branchCompanyId)
                // console.log(this.form.listData)
                // if (refresh) {
                  this.branchCompanChange(true)
                // }
            }
        },
        getRigthList(data, index) {
            this.curTemplateIndex = index
            this.form.rightList = data.detailsVOS || []
            this.$refs.table.refresh(true)
        },
        validateForm() {
            let flag = false
            // 校验是否有空模板
            // 当前表单提交的模板数据
            let listData = this.form.listData

            // 检验当前提交数据是否包含每个价格信息名称配置
            let list = this.costPriceDataList.filter((item, index) => {
              let id = item.id
              return (!listData[id] || listData[id].length == 0)
            })?.map(e => e.name);

            if (list.length) {
              this.$notification.error({
                message: '提示',
                description:
                  `成本价格信息【${list.join('、')}】未添加模板！`,
              });
            } else {
              flag = true
            }
            return flag
        },
        async delSubcontractorCost(params){
               const [err, res] = await delSubcontractorCost(params)
                if (!err) {
                    this.$message.success('删除成功')
                    this.handleClose()}
        },

        // 处理增、删、改操作
        async handleSave(status, next = '') {
          // 1-一般,2-安装,3-装饰(后续依次补录)
          let typemap = { decorate: 3, install: 2, normal: 1}[this.companyType]
          const params = {
              ...this.form,
              type: typemap,
              status
          }
          delete params.additionalPropId
          delete params.illustrateInfo
          delete params.costPriceInfo
          if (this.id) {
            params.id = this.id
          }
          console.log(params)

          if(status=='SUBMITTED') {
            this.$refs.ruleForm.validate((valid) => {
              console.log(valid)
                if (valid) {
                  if (!this.validateForm()) return
                  this.submitApprovalConfirm(this.processConfig, (flag)=>{
                    if(!flag) {
                      return
                    }
                    this.submitForm(status, params)
                  })

                } else {
                  this.$message.warning("请填写完所有必填项信息")
                }
            })
          } else {
            this.$refs.ruleForm.validate((valid) => {
              if (valid) {
                this.submitForm(status, params)
              } else {
                this.$message.warning("请填写完所有必填项信息")
              }
            })
          }
          // if (this.loading[status]) return

          // this.loading[status] = true

          // console.log(params)
          // console.log(this.form)
          // subcontractorCostEdit(params).then((res) => {
          //   this.loading[status] = false
          //   let msg = status == 'SUBMITTED' ? '提交' : '保存'
          //   if (res.code == 200 || res.data.code == 200) {
          //     this.$message.success(`${msg}成功`)
          //     this.$close()
          //   }
          // }).catch(() => {
          //   this.loading[status] = false
          // })
        },
        submitForm(status, params) {
          this.setProcessConfig = null;
          if (this.loading[status]) return

          this.loading[status] = true

          console.log(params)
          console.log(this.form)
          return subcontractorCostEdit(params).then((res) => {
            this.loading[status] = false
            let msg = status == 'SUBMITTED' ? '提交' : '保存'
            if (res.code == 200 || res.data.code == 200) {
              this.$message.success(`${msg}成功`)
              if(status =='SUBMITTED') {
                //提交时，返回id
                    this.businessId = res.data|| this.id;
                    this.setProcessConfig = this.processConfig;
                    return
                }else{
                this.$close()
              }
            }
          }).catch(() => {
            this.loading[status] = false
          })
        },
        fillInSave(single) {
          this.setProcessConfig = null;
          let listData = this.form.listData

          let allList = []
          let noFilled = []
          for (let idx in listData) {
            if (single) {
              if (idx !== this.form.additionalPropId) continue
            }
            let list = listData[idx]
            list.forEach((item, index) => {
              let {
                auxiliaryMaterialFee, companyControlFeeNotIncludeFex, comprehensiveUnitPrice, featureDesc,
                jobContent, laborCost, listId, mainMaterialLossRate, materialAndMechanicalEquipmentSupply,
                partAndProject, projectCountRules, remark, unitOfMeasurement, fillInDataList
              } = item
              let obj = {
                auxiliaryMaterialFee, companyControlFeeNotIncludeFex, comprehensiveUnitPrice, featureDesc,
                jobContent, laborCost, listId, mainMaterialLossRate, materialAndMechanicalEquipmentSupply,
                partAndProject, projectCountRules, remark, unitOfMeasurement
              }
              if (item.id) {
                obj.id = item.id
              }

              let fillInData = item.fillInData || {}
              let {
                auxiliaryMaterialFeeInfo, comprehensiveUnitPriceInfo, introduceInfo, laborCostInfo,
                mainMaterialLossRateInfo, signFee, signTime, projectId, projectName, sortNum
              } = fillInData
              obj.fillInData = {
                auxiliaryMaterialFeeInfo, comprehensiveUnitPriceInfo, introduceInfo, laborCostInfo,
                mainMaterialLossRateInfo, signFee, signTime, projectId, projectName, sortNum
              }
              if (fillInData.id) {
                obj.fillInData.id = fillInData.id
              }
              if (this.$currentPost().code == 'PD') {
                obj.fillInData.projectId = this.$currentPost().id
                obj.fillInData.projectName = this.$currentPost().name
                // obj.fillInData.sortNum = fillInDataList?.length || 0
              }

              if (this.companyType == 'normal') {
                if (this.$isEmpty(obj.fillInData.signFee) || !obj.fillInData.signTime) {
                  if (!noFilled.find(e => e.id == idx)) {
                    noFilled.push(this.costPriceDataList.find(e => e.id == idx))
                  }
                }
              } else if (this.companyType == 'install') {
                if (this.$isEmpty(obj.fillInData.mainMaterialLossRateInfo) || this.$isEmpty(obj.fillInData.laborCostInfo) ||
                  this.$isEmpty(obj.fillInData.comprehensiveUnitPriceInfo) || !obj.fillInData.signTime
                ) {
                  if (!noFilled.find(e => e.id == idx)) {
                    noFilled.push(this.costPriceDataList.find(e => e.id == idx))
                  }
                }
              } else {
                if (this.$isEmpty(obj.fillInData.laborCostInfo) || this.$isEmpty(obj.fillInData.auxiliaryMaterialFeeInfo) ||
                  this.$isEmpty(obj.fillInData.comprehensiveUnitPriceInfo) || !obj.fillInData.signTime
                ) {
                  if (!noFilled.find(e => e.id == idx)) {
                    noFilled.push(this.costPriceDataList.find(e => e.id == idx))
                  }
                }
              }
              allList.push(obj)
            })
          }

          console.log(allList)
          console.log(noFilled)
          if (noFilled.length) {
            this.$notification.error({
              message: '提示',
              description:
                `成本价格信息【${noFilled.map(e => e.name).join('、')}】未填写完整！`,
            });
            return
          }
          if (!single) {
            this.$confirm({
                title: '温馨提示',
                content: '提交后不可修改，确认提交吗？',
                okText: '是',
                cancelText: '否',
                onOk: () => {
                    return this.submitFill(allList, single)
                },
            })
          } else {
            this.submitFill(allList, single)
          }
        },
        submitFill(allList, single) {
          this.loading.FILLIN = true
          return subcontractorCostFillIn(allList).then((res) => {
            this.loading.FILLIN = false
            if (res.code == 200 || res.data.code == 200) {
              this.checkSubcontractorCostReq(true)
              if (!single) {
                fillStatus({ id: this.id, fillId : this.$currentPost().id }).then((result) => {
                  this.$message.success('填报成功')
                  this.$close()
                })
              }
            }
          }).catch(() => {
            this.loading.FILLIN = false
          })
        },
        fillIn() {
          console.log(this.form)
          let listData = this.form.listData
          let params = this.form.listData[this.form.additionalPropId]
          params = params.map((item, index) => {
            let {
              auxiliaryMaterialFee, companyControlFeeNotIncludeFex, comprehensiveUnitPrice, featureDesc,
              fillInData, jobContent, laborCost, listId, mainMaterialLossRate, materialAndMechanicalEquipmentSupply,
              partAndProject, projectCountRules, remark, unitOfMeasurement, fillInDataList
            } = item
            let obj = {
              auxiliaryMaterialFee, companyControlFeeNotIncludeFex, comprehensiveUnitPrice, featureDesc,
              jobContent, laborCost, listId, mainMaterialLossRate, materialAndMechanicalEquipmentSupply,
              partAndProject, projectCountRules, remark, unitOfMeasurement
            }
            if (item.id) {
              obj.id = item.id
            }
            let {
              auxiliaryMaterialFeeInfo, comprehensiveUnitPriceInfo, introduceInfo, laborCostInfo,
              mainMaterialLossRateInfo, signFee, signTime, projectId, projectName, sortNum
            } = fillInData
            obj.fillInData = {
              auxiliaryMaterialFeeInfo, comprehensiveUnitPriceInfo, introduceInfo, laborCostInfo,
              mainMaterialLossRateInfo, signFee, signTime, projectId, projectName, sortNum
            }
            if (fillInData.id) {
              obj.fillInData.id = fillInData.id
            }
            if (this.$currentPost().code == 'PD') {
              obj.fillInData.projectId = this.$currentPost().id
              obj.fillInData.projectName = this.$currentPost().name
              obj.fillInData.sortNum = fillInDataList?.length || 0
            }
            return obj
          })
          console.log(params)
          // subcontractorCostFillIn(params).then((res) => {
          //   console.log(res)
          //   if (res.code == 200 || res.data.code == 200) {
          //     this.checkSubcontractorCostReq(true)
          //   }
          // })
        },
        handleClose() {
            this.$multiTab.close(this.$route.fullpath)
            if (this.isAudit) {
                window.close()
            } else {
                this.$multiTab.close(this.$route.fullpath)
            }
        },
    },
}
</script>
<style lang="less" scoped>
@deep: ~'>>>';
.tool-btns {
    display: flex;
    justify-content: flex-end;
    @{deep} .ant-btn + .ant-btn {
        margin-left: 12px;
    }
}
.footer-btn {
    width: 200px;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
}
.col-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    font-weight: bold;
    margin-bottom: 24px;
}
.title-s {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    // margin-left: 20px;
    text-indent: 20px;
    font-weight: 500;
    margin-bottom: 24px;
}
.title-s-s {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    // margin-left: 20px;
    text-indent: 40px;
    font-weight: 500;
    margin-bottom: 24px;
}
.inputStyl {
    border-color: #e4ac0b;
    background-color: #fff9e8;
}
.ant-form {
    // min-height: 200px;
}
</style>
